﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NiuX.LightServer;
using NiuX.LightServer.Handlers;
using NiuX.LightServer.Models;
using NiuX.LightServer.Options;

namespace NiuX.Samples.LightServer
{
    class Program
    {
        static async Task Main(string[] args)
        {
            // 实例化一个server
            var server = new Server();

            server.EnableCors().AddHandler(new HttpHandler()
            {
                Method = "GET",
                Path = "/api/test",
                Handler = (req, resp) => resp.Write("['Hello','NiuX']")
            });

            await server.RunAsync();
            Console.Read();
        }
    }
}
